<template>
  <div>
    <div v-if="list.length > 0" class="pact">
      <dl>
        <dt class="pact-i-1">合同编号</dt>
        <dt class="pact-i-2">合同名称</dt>
        <dt class="pact-i-3">签约日期</dt>
        </dl>
        <dl class="pact-i" v-for="(item, index) in list" :key="index">
          <dd class="pact-i-1"><span>{{item.order.orderId}}</span></dd>
          <dd class="pact-i-2" v-if="item.plan">
            <a href="javascript:void(0)" @click="showRiskDisclosureFlag = true">{{item.plan.name}}-风险揭示书</a>
            <a href="javascript:void(0)" @click="showAgreementFlag = true">{{item.plan.name}}-投顾服务协议</a>
          </dd>
          <dd class="pact-i-3"><span>{{item.order.createTime | parseTime('{y}年{m}月{d}日')}}</span></dd>
      </dl>
    </div>
    <NoDataTips v-else/>
    <Agreement typeName="agreement" v-if="showAgreementFlag" @closeFn="closeAgreementBox"/>
    <Agreement typeName="riskDisclosure" v-if="showRiskDisclosureFlag" @closeFn="closeRiskDisclosureBox"/>
  </div>
</template>

<script>
import Agreement from '@/components/agreement/agreement'
export default {
  components: {
    Agreement
  },
  props: ['list'],
  data () {
    return {
      showAgreementFlag: false,
      showRiskDisclosureFlag: false
    }
  },
  methods: {
    deleteOrder (item) {
      let that = this
      window.layer.open({
        type: 1,
        offset: 'auto',
        id: 'layerDemo' + 'auto', // 防止重复弹出
        content: '<div style="padding: 20px 100px;">确认删除该订单吗</div>',
        btn: '确认',
        btnAlign: 'c',
        shade: 0,
        yes: function () {
          that.showBuyQuestionBox(item)
          if (window.layer) {
            window.layer.closeAll()
          }
        }
      })
    },
    execDelete (item) {
      console.log('删除订单')
    },
    closeAgreementBox () {
      this.showAgreementFlag = false
    },
    closeRiskDisclosureBox () {
      this.showRiskDisclosureFlag = false
    }
  }
}
</script>

<style scoped lang="scss">
.pact {
  overflow: auto;
  margin-top: 20px;
}
.pact dl{
  padding: 0 16px;
  display: block;
  overflow: auto;
}
.pact dt,.pact dd{
  float: left;
}
.pact dt{
  height: 36px;
  line-height: 36px;
  font-weight: bold;
  background-color: #f2f2f2;
  text-align: center;
}
.pact .pact-i{
  border-bottom: 1px solid #e6e6e6;
  color: #808080;
  padding: 24px 16px;
}
.pact .pact-i a{
  display: block;
  color: #5293e2;
}
.pact-i-1{
  width: 260px;
  text-align: center;
}
.pact-i-2{
  width: 468px;
}
.pact-i-3{
  width: 230px;
  text-align: center;
}
.pact .pact-i .pact-i-2 a{
  text-indent: 110px;
  line-height: 22px;
}
</style>
